package com.bright.hxj.qchz.service;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.bright.hxj.qchz.pojo.bo.DuijieReturnMsg;
import com.bright.hxj.qchz.pojo.po.TaskAsync;
import org.json.JSONObject;

import java.util.List;
import java.util.function.Function;

/**
 * @Author hxj
 * @Date 2025/1/4 16:51
 * @Description
 */
public interface TaskManager {

    // 异步任务状态
    //0 待处理
    //1 操作成功
    //2 数据校验失败
    //3 出现异常
    int ASYNC_TASK_WAITING = 0;
    int ASYNC_TASK_SUCCESS = 1;
    int ASYNC_TASK_CHECK_FAILED = 2;
    int ASYNC_TASK_ERROR = 3;


    void writeToLogTable(JSONObject jsonObject, String userName, String methodName, String taskId, String ztId);

    boolean insertTaskToDB(TaskAsync taskAsync);

    void updateTaskStatus(String taskId, String userName, int statusFlag, String msg, Object data);

    List<TaskAsync> getTaskDataByTaskId(String taskId);

    List<TaskAsync> getTaskDataByTaskId(String taskId, Function<LambdaQueryWrapper<TaskAsync>, LambdaQueryWrapper<TaskAsync>> queryWrapperFunction);

    DuijieReturnMsg getTaskStatus(String taskId);
}
